home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr48 / asm32v20.zip / INPUT.DOC < prev    next >
Text File  |  1993-12-23  |  27KB  |  836 lines

  1.  
  2. ********************************  INPUT  ************************************
  3.  
  4. ASM32 Input subroutines (C) Copyright 1993 Douglas Herr
  5. all rights reserved
  6.  
  7. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  8.  
  9. $EDIT:       editor module used by TEdit and GEdit.
  10.              Must be called by GEdit or TEdit
  11. Source:      $edit.asm (getkey.asm, isdigit.asm, toupper.asm, tolower.asm)
  12.  
  13.              TEdit and GEdit edit a string on a single row of the screen
  14.              (without word wrap).  Strings longer than the column width of
  15.              the screen are scrolled left or right as required.  A public
  16.              byte in $edit's data area, EWIDTH, establishes the effective
  17.              screen width limit.  EWIDTH is a not-to-exceed limit; if the
  18.              actual screen width is less than EWIDTH, EWIDTH is ignored
  19.              and the actual screen width is used instead.  ASM32's default
  20.              EWIDTH is 132.
  21.  
  22.              $edit commands for both TEdit and GEdit are:
  23.  
  24.              Ctrl+left arrow = word left
  25.              Ctrl+right arrow = word right
  26.              Ctrl+end = clear to end of string
  27.              Home = go to start of string
  28.              End = go to end of string
  29.  
  30.  
  31.              Option bits, passed to GEdit or TEdit in register AL, are:
  32.  
  33.              Option 1 = upper case input
  34.              Option 2 = lower case input
  35.              Option 1 OR 2 = digits only input
  36.  
  37. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  38.  
  39. CLEARKEY:    clears the keyboard's 'type-ahead' buffer
  40.              Uses BIOS functions to remove all keys in the buffer.
  41. Source:      clearkey.asm (keywait.asm, getkey.asm)
  42.  
  43. Call with:   no parameters
  44. Returns:     nothing
  45. Uses:        nothing
  46. Example:
  47.  
  48. extrn   clearkey:near
  49.  
  50. include codeseg.inc
  51.  
  52.         .
  53.         .
  54.         .
  55.         call   clearkey
  56.  
  57.  
  58.  
  59. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  60.  
  61. GEDIT:       string editor for graphics modes
  62.              See also TEdit for text modes, $EDIT for general information
  63. Source:      gedit.asm ($edit.asm, gprint.asm, $graph.asm, gcursor.asm,
  64.                         gputchr.asm)
  65.  
  66. Call with:   ESI pointing to string buffer; may include a default string
  67.              EDX pointing to x- & y-coordinates
  68.              ECX = byte size of buffer
  69.              AL = option bits (see $edit)
  70.              GEdit only works with DrawMode 1 or -1 (see DrawMode in
  71.              GRAPHICS.DOC).  GEdit forces drawmode to 1 or -1 and restores
  72.              the previous drawmode on exit.
  73. Returns:     AX = last key pressed (see getkey for key codes)
  74.              ECX = new string length
  75. Uses:        EAX, ECX, flags
  76. Supports:    all ASM32 graphics modes
  77. Example:
  78.  
  79. include dataseg.inc
  80.  
  81. ; data
  82. x       dw 8                      ; x-coordinate (pixels from left edge)
  83. y       dw 100                    ; y-coordinate (pixels from top of screen)
  84. extrn   ewidth:byte               ; byte in $edit used to limit columns
  85.                                   ; displayed
  86. @curseg ends
  87.  
  88. include codeseg.inc
  89.  
  90.         .
  91.         .
  92.         .
  93.         mov   ewidth,40           ; there's stuff on the right side of
  94.                                   ; the screen that should be left alone
  95.  
  96.         lea   esi,string_buffer   ; near address of string buffer
  97.         mov   ecx,len_buffer      ; byte length of buffer for the string
  98.         mov   al,0                ; nothing tricky
  99.         lea   edx,x               ; point to x & y coordinates
  100.                                   ; see GPrint for explanation of x and y
  101.         call  gedit
  102.  
  103.  
  104.  
  105. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  106.  
  107. GETKEY:      returns next key pressed
  108. Source:      getkey.asm
  109.  
  110. Call with:   no parameters
  111. Returns:     AL = ASCII key code
  112.              AH = 0 if normal key
  113.              AH = 1 if extended key code (such as function keys)
  114. Uses:        AX
  115.              Uses BIOS functions; supports enhanced keyboard if present
  116. Supports:    standard and enhanced keyboards
  117. Example:
  118.  
  119. extrn   getkey:near
  120.  
  121. include codeseg.inc
  122.  
  123.         .
  124.         .
  125.         .
  126.         call  getkey
  127.         shr   ah,1            ; a function key?
  128.         jc    function_key    ; jump if so
  129.  
  130.  
  131. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  132.  
  133. GPICKF:      pick a file from a list of filenames
  134.              GPickF pops a window on the screen and displays filenames
  135.              matching an input filespec mask.  One filename may be selected
  136.              with cursor keys or with hotkeys.  When Esc, Enter or ^C is
  137.              pressed, GPickF restores the screen and returns the selected
  138.              filename to the calling program.  See also MenuOption.
  139. Source:      gpickf.asm (filelist.asm, $gpick.asm, $menu.asm, $graph.asm)
  140.  
  141. Call with:   ESI pointing to filespec mask
  142.              BX = initial selection (0 = first filename)
  143.              CX = file attribute mask
  144.              EDX pointing to upper left corner of menu box
  145. Returns:     AX = last key pressed
  146.              EBX points to ASCIIZ filename selected
  147. Uses:        AX, EBX
  148. Supports:    all ASM32 graphics modes
  149. Example:     see PICKF
  150.  
  151. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  152.  
  153. GPICKSTR:    pick a string from a list of ASCIIZ strings
  154. Source:      gpickstr.asm ($gpick.asm, $strlist.asm, $menu.asm, $graph.asm)
  155.  
  156. Call with:   ESI pointing to list of ASCIIZ strings
  157.              BX = initial cursor position
  158.              EDX pointing to (x,y) coordinates of upper left corner
  159.                of selection box
  160.  
  161.              GPickStr pops a window on the screen and displays the list
  162.              of strings.  One string may be selected with cursor keys
  163.              or with hotkeys.  When Esc or Enter is pressed, GPickStr
  164.              restores the screen and returns a string index number.
  165.              See also MenuOption.  Maximum number of choices: 255
  166.  
  167. Returns:     AX = last key pressed
  168.              EBX = string number selected (first string = 0)
  169. Uses:        EAX, EBX, flags
  170. Supports:    all ASM32 graphics modes
  171. Example:     see PICKSTR
  172.  
  173.  
  174. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  175.  
  176. ISALPHA:     determines if a keycode returned by GetKey is a letter from
  177.              A-Z or a-z.
  178. Source:      isalpha.asm
  179.  
  180. Call with:   AX = keycode returned by GetKey.
  181. Returns:     if CF = 0, keycode is a character from A-Z or a-z
  182.              if CF = 1, keycode is not a character from A-Z or a-z
  183.              AX is not changed
  184. Uses:        CF
  185. Example:     call   getkey       ; get next keystroke
  186.              call   isalpha
  187.              jc     not_alpha
  188.  
  189.  
  190. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  191.  
  192. ISDIGIT:     determines if a keycode returned by GetKey is the ASCII code
  193.              for the numeric characters 0-9
  194. Source:      isdigit.asm
  195.  
  196. Call with:   AX = keycode returned by GetKey.
  197. Returns:     if CF = 0, keycode is a character from 0-9
  198.              if CF = 1, keycode is not a character from 0-9
  199.              AX is not changed
  200. Uses:        CF
  201. Example:     call   getkey       ; get next keystroke
  202.              call   isdigit      ; I want numbers only
  203.              jc     not_a_number
  204.  
  205.  
  206.  
  207. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  208.  
  209. ISLOWER:     determine if a keycode returned by GetKey is lower case
  210. Source:      islower.asm
  211.  
  212. ISUPPER:     determine if a keycode returned by GetKey is upper case
  213. Source:      isupper.asm
  214.  
  215. Call with:   AX = keycode returned by GetKey.
  216. Returns:     if CF = 0, keycode is a character from A-Z or a-z
  217.              if CF = 1, keycode is not a character from A-Z or a-z
  218.              AX is not changed
  219. Uses:        CF
  220. Example:     call   getkey       ; get next keystroke
  221.              call   isupper      ; is it upper case?
  222.              jc     not_upper    ; no; could be lower case
  223.  
  224.  
  225.  
  226. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  227.  
  228. JANEIN:      German language version of YesNo
  229.              waits for 'J' or 'N' key to be pressed
  230. Source:      janein.asm
  231.  
  232. Call with:   no parameters
  233.              Key pressed may be upper or lower case.  Upper case is
  234.              returned.  Uses BIOS functions
  235. Returns:     AX = 'J' or AX = 'N'
  236.              future version will also return ^C
  237. Uses:        AX
  238. Example:
  239.  
  240. extrn   JaNein:near
  241.  
  242. include codeseg.inc
  243.  
  244.         .
  245.         .
  246.         .
  247.         call  JaNein
  248.  
  249.  
  250.  
  251. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  252.  
  253. KEYORBUTTON: waits for first keypress or mouse button click
  254. Source:      mouse.asm (getkey.asm)
  255.  
  256. Call with:   no parameters
  257.              If a keypress is waiting in the keyboard buffer before
  258.              this subroutine is called, the keycode is returned to
  259.              the calling program without checking mouse button status.
  260. Returns:     AX = keycode, BX = mouse button code (see MouseStatus)
  261. Uses:        AX, BX
  262. Example:     call   keyorbutton
  263.  
  264.  
  265. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  266.  
  267. KEYWAITING:  Determines if a key is waiting in the keyboard buffer.
  268.              Does not remove the key code from the buffer.  Uses BIOS.
  269. Source:      keywait.asm
  270.  
  271. Call with:   no parameters
  272. Returns:     CF = 1 if no key waiting
  273.              CF = 0 if key waiting
  274. Uses:        CF
  275. Example:
  276.  
  277. extrn   keywaiting:near
  278.  
  279. include codeseg.inc
  280.  
  281.         .
  282.         .
  283.         .
  284.         call   keywaiting
  285.         jc     no_key_pressed
  286.         call   getkey           ; get the key that was pressed
  287.  
  288.  
  289. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  290.  
  291. MENUOPTION:  options for PULLDOWN, PICKF, GPICKF, PICKSTR and GPICKSTR
  292. Source:      $menu.asm
  293.  
  294. Call with:   AX = option value
  295.              BX = option number
  296.  
  297.              If you do not specify any options or if you call MenuOption
  298.              with AX = 0, default values are assumed.
  299.  
  300.              options available are:           defaults:
  301.                0 = normal text color            07h
  302.                1 = current selection color      70h
  303.                2 = list box color               0Fh
  304.                3 = hotkey color                 0Fh         (1)
  305.                4 = optional quitkey             no quitkey  (2)
  306.                5 = exit when hotkey pressed     00h         (3)
  307.                6 = box frame type (see WFRAME)  -1          (4)
  308.  
  309. NOTE: DEFAULT COLORS MAY NOT BE SUITABLE FOR SOME GRAPHICS MODES
  310.  
  311. (1) the first upper-case letter in each string is that string's hotkey
  312.     no upper-case character = no hotkey
  313. (2) the quitkey value is a keycode returned by GetKey
  314. (3) use AX = -1 for exit when hotkey pressed, AX = 0 to disable
  315. (4) text modes only
  316.  
  317. Returns:     nothing
  318. Uses:        nothing
  319. Supports:    GPickF, GPickStr, PullDown, PickF, PickStr menu systems
  320. Example:
  321.  
  322. extrn   menuoption:near, pickstr:near
  323.  
  324. include codeseg.inc
  325.  
  326.           .
  327.           .
  328.           .
  329.           mov   bx,0         ; text color
  330.           mov   ax,23        ; white w/ blue background
  331.                              ; 16-color in graph modes, this would be
  332.                              ; MOV  AX,0107h  (see GCOLOR in GRAPHICS.DOC)
  333.           call  menuoption
  334.  
  335.  
  336.  
  337.  
  338. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  339.  
  340. MOUSELIMIT:  limits mouse's range of motion
  341. Source:      mouse.asm
  342.  
  343. Call with:   EBX pointing to pixel coordinates of minimum and maximum
  344.              x and y limits.  X-limits are the horizontal dimension and
  345.              y-limits are the vertical dimension.
  346. Returns:     nothing
  347. Uses:        nothing
  348. Example:
  349.  
  350. include dataseg.inc
  351.  
  352. x0    dw 30
  353. y0    dw 15
  354. x1    dw 620
  355. y1    dw 250
  356.  
  357. @curseg ends
  358.  
  359. include codeseg.inc
  360.  
  361.        .
  362.        .
  363.        .
  364.       lea    ebx,x         ; EBX points to limits
  365.       call   mouselimit
  366.  
  367.  
  368.  
  369. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  370.  
  371. MOUSEPOS:    sets the mouse's position
  372. Source:      mouse.asm
  373.  
  374. Call with:   EDX pointing to desired x- and y-coordinates
  375.              Note that mouse coordinates are expressed as a pixel location
  376.              as with graphics mode, even if the system is in text mode
  377. Returns:     nothing
  378. Uses:        nothing
  379. Example:
  380.  
  381. extrn   mousepos:near
  382.  
  383. include dataseg.inc
  384.  
  385. x     dw 100
  386. y     dw 25
  387.  
  388. @curseg ends
  389.  
  390. include codeseg.inc
  391.  
  392.       .
  393.       .
  394.       .
  395.       lea    edx,x         ; EDX points to desired position
  396.       call   mousepos
  397.  
  398.  
  399. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  400.  
  401. MOUSESTATUS: determine mouse position & buttons pressed
  402. Source:      mouse.asm
  403.  
  404. Call with:   no parameters
  405. Returns:     if ZF = 1, no buttons are pressed
  406.              if ZF = 0, BX = button code
  407.               BX bit 0 if set = left button is down
  408.               BX bit 1 if set = right button is down
  409.               BX bit 2 if set = center button is down
  410.              CX = horizontal (x) coordinate
  411.              DX = vertical (y) coordinate
  412.              Note that mouse positions are expressed as a pixel location
  413.              as with graphics mode, even if the system is in text mode
  414. Uses:        EBX, ECX, EDX, flags
  415. Example:     call  mousestatus
  416.              jz    no_buttons     ; no buttons pressed if ZF = 1
  417.  
  418.  
  419.  
  420. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  421.  
  422. OUINON:      French language version of YesNo
  423.              waits for 'O' or 'N' key to be pressed
  424. Source:      ouinon.asm
  425.  
  426. Call with:   no parameters
  427.              Key pressed may be upper or lower case.  Upper case is
  428.              returned.  Uses BIOS functions
  429. Returns:     AX = 'O' or AX = 'N'
  430.              future version will also return ^C
  431. Uses:        AX
  432. Example:
  433.  
  434. extrn   ouinon:near
  435.  
  436. include codeseg.inc
  437.  
  438.         .
  439.         .
  440.         .
  441.         call  OuiNon
  442.  
  443.  
  444.  
  445.  
  446.  
  447. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  448.  
  449. PICKF:       pick a file from a list of filenames
  450.              PickF pops a window on the screen and displays filenames
  451.              matching an input filespec mask.  One filename may be selected
  452.              with cursor keys or with hotkeys.  When Esc, Enter or ^C is
  453.              pressed, PickF restores the screen and returns the selected
  454.              filename to the calling program.
  455.  
  456.              PickF allocates a block of low memory which should be released
  457.              after you are done with it.  See example;  See also MenuOption.
  458. Source:      pickf.asm ($tpick.asm, filelist.asm, wsave.asm, $menu.asm)
  459.  
  460. Call with:   ESI pointing to filespec mask
  461.              BX = initial cursor position
  462.              CX = file attribute mask
  463.              DH = top screen row for list
  464.              DL = left screen column for list
  465. Returns:     if CF = 0, AX = last key pressed
  466.                         EBX points to filename selected
  467.              if CF = 1, no filenames match input filespec
  468. Uses:        AX, EBX, flags
  469. Supports:    text mode
  470. Example:
  471.  
  472. public  myproc
  473. extrn   pickf:near
  474.  
  475. include dataseg.inc
  476.  
  477. filespec db '*.asm',0            ; search for ASM source code
  478.  
  479. @curseg ends
  480.  
  481. include codeseg.inc
  482.         .
  483.         .
  484.         .
  485.         lea     esi,filespec
  486.         mov     bx,0             ; start at top of list
  487.         xor     dx,dx            ; upper left corner of screen
  488.         mov     cx,0             ; normal files only
  489.         call    pickf
  490.         cmp     ax,0Dh           ; was Enter the last key pressed?
  491.         jne     abort            ;  nope - someone wants out
  492.  
  493.  
  494. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  495.  
  496. PICKSTR:     pick a string from a list of ASCIIZ strings
  497. Source:      pickstr.asm ($tpick.asm, $strlist.asm, wsave.asm, $menu.asm)
  498.  
  499. Call with:   ESI pointing to list of ASCIIZ strings
  500.              BX = initial cursor position
  501.              DH = top screen row for list
  502.              DL = left screen column for list
  503.  
  504.              PickStr pops a window on the screen and displays the list
  505.              of strings.  One string may be selected with cursor keys
  506.              or with hotkeys.  When Esc, Enter or ^C is pressed, PickStr
  507.              restores the screen and returns a string index number.
  508.              See also MenuOption.  Maximum number of choices: 255
  509.  
  510. Returns:     AX = last key pressed
  511.              EBX = string number selected (first string = 0)
  512. Uses:        EAX, EBX, flags
  513. Supports:    text mode
  514. Example:
  515.  
  516. public  myproc
  517. extrn   pickstr:near
  518.  
  519. include dataseg.inc
  520.  
  521. string1 db 'January',0
  522.         db 'February',0
  523.         db 'March',0
  524.         db 'April',0
  525.         db 'May',0
  526.         db 'June',0
  527.         db 'July',0
  528.         db 'August',0
  529.         db 'September',0
  530.         db 'October',0
  531.         db 'November',0
  532.         db 'December',0
  533.         db 0              ; mark end of menu strings
  534.  
  535. @curseg ends
  536.  
  537. include codeseg.inc
  538.  
  539.         .
  540.         .
  541.         lea  esi,string1
  542.         mov  bx,1
  543.         xor  dx,dx
  544.         call pickstr
  545.  
  546. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  547.  
  548. PULLDOWN:    pull-down menu system
  549. Source:      pulldown.asm ($menu.asm, tprint.asm, tputchr.asm, strlen.asm,
  550.                            wclear.asm, wframe.asm, wsize.asm, wsave.asm,
  551.                            getkey.asm, pickstr.asm and others)
  552.  
  553. Call with:   [ESI] pointing to menu labels
  554.              BL = initial main menu choice, BH = initial submenu choice
  555.  
  556.              If PullDown is called with BH = 0FFh, only the main headings are
  557.              printed initally; the submenus are printed when ENTER is
  558.              pressed or a mouse button is pressed.
  559.  
  560.              If PullDown is called with BL <> 0FFh, it starts in the full
  561.              main headings plus submenus mode.  In this mode, a mouse button
  562.              click or the ENTER key will exit PullDown.  In either mode,
  563.              ESC, ^C or the user-defined quitkey (see MenuOption) causes
  564.              PullDown to return to the calling program.
  565.  
  566.              If there are too many main headings to fit across the top of the
  567.              screen, the headings are scrolled left or right as required to
  568.              show the selected heading.  Use Left, Right, Home and End keys
  569.              to change selected headings.
  570.  
  571.              If there are too many submenu choices under a heading to fit
  572.              on the screen, the selections are scrolled up or down as required
  573.              to show the selected item.  Use Up, Down, PgUp, PgDown keys
  574.              to change selection, or press highlighted letter of selection.
  575.              Maximum number of selections per heading: 255
  576.  
  577. Returns:     BL = main menu choice, BH = submenu choice
  578.              if CF = 1, ^C or Ctrl-Break was pressed
  579.              if CF = 0
  580.                  AX = 13 if ENTER was pressed
  581.                  AX = user-defined quitkey if pressed (see MenuOption)
  582.                  AX = 27 if ESC was pressed
  583.                  AH = 1-7, AL = 0 if mouse button pressed
  584. Uses:        AX, BX
  585. Supports:    text mode; all row/column configurations supported by ASM32
  586.              Text subroutines
  587. Example:
  588.  
  589. see next page
  590.  
  591.  
  592. ;    this sample menu has 4 main menu headings:
  593. ;                          Critters, Things, Food, Trees
  594. ;    submenu choices for each main heading follow each main heading
  595. ;    Note that each string is terminated with NUL, and that there's an
  596. ;    extra NUL between the end of the submenu choices and the next main
  597. ;    heading.
  598. ;    The entire set of menu choices is terminated with 2 NUL bytes
  599. ;
  600. ;    PULLDOWN will return to the calling program when either ESCAPE or
  601. ;    ENTER is pressed (AX = ASCII code of key pressed).  PULLDOWN returns
  602. ;    AX = 0 if insufficient memory is available to save the underlying
  603. ;    screen, or AX = 3 if breaktrap was enabled and Ctrl+Break was pressed.
  604. ;
  605. ;    On return, BH = the main heading and BL = the submenu choice in effect
  606. ;    when the key was pressed.  The first main heading is number 0, and
  607. ;    the first submenu choice for each main heading is also number 0.
  608.  
  609. include model.inc
  610.  
  611. extrn   pulldown:near
  612.  
  613. include dataseg.inc
  614. menu    db 'Critters',0
  615.         db 'Goats',0,'Chickens',0,'Turkeys',0,'Cows',0,'Snow dogs',0
  616.  
  617.         db 0                   ; separate Things from Critters
  618.         db 'Things',0
  619.         db 'Computers',0,'Tractors',0,'CPU chips',0,'Barbie dolls',0
  620.  
  621.         db 0                   ; separate Food from Things
  622.         db 'Food',0
  623.         db 'Hot dogs',0,'Wheat germ',0,'Lasagne',0,'Cheerios',0
  624.         db 'Potatoes',0,'chocolate chip cooKies',0
  625.  
  626.         db 0                   ; separate Trees from Food
  627.         db 'Trees',0
  628.         db 'giant Sequoia',0,'black Spruce',0,'Willow',0,'live Oak',0
  629.         db 'Acacia',0,'digger Pine',0
  630.  
  631.         db 2 dup(0)            ; end of menu choices
  632.  
  633. include codeseg.inc
  634.         .
  635.         .
  636.         .
  637.         lea   esi,menu          ; point to menu labels
  638.         xor   ebx,ebx           ; initial selection is "goats"
  639.         call  pulldown
  640.  
  641.  
  642. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  643.  
  644. SINO:        Spanish language version of YesNo
  645.              waits for 'S' or 'N' key to be pressed
  646. Source:      sino.asm
  647.  
  648. Call with:   no parameters
  649.              Key pressed may be upper or lower case.  Upper case is
  650.              returned.  Uses BIOS functions
  651. Returns:     AX = 'S' or AX = 'N'
  652.              future version will also return ^C
  653. Uses:        AX
  654. Example:
  655.  
  656. extrn   sino:near
  657.  
  658. include codeseg.inc
  659.  
  660.         .
  661.         .
  662.         .
  663.         call  sino
  664.  
  665.  
  666. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  667.  
  668. TEDIT:       ASCIIZ string editor for text modes
  669.              See also GEdit for graphics modes, $edit for general information.
  670.              TEdit turns the cursor off (with CursorOFF) on exit.
  671. Source:      tedit.asm ($edit.asm, cursor.asm, a$clrw.asm, str2vbuf.asm,
  672.                         crtinfo.asm)
  673.  
  674. Call with:   ESI pointing to string buffer; may include a default string
  675.              ECX = byte size of buffer (excluding terminating NUL)
  676.              AH = color attribute
  677.              AL = option bits (see $edit)
  678.              DH = row (offset from top of screen)
  679.              DL = column (offset from left edge of screen)
  680.  
  681. Returns:     AX = last key pressed (see GetKey for key codes)
  682.              ECX = new string length
  683. Uses:        EAX, ECX, flags
  684. Supports:    text modes; all row/column configurations
  685. Example:
  686.  
  687. include dataseg.inc
  688.  
  689. string_buffer db 100 dup(0)
  690. len_buffer    equ 99               ; leave one byte for terminal NUL
  691. row           db 10
  692. column        db 40
  693. attr          db 12                ; color attribute
  694.  
  695. @curseg ends
  696.  
  697. include codeseg.inc
  698.         .
  699.         .
  700.         .
  701.         lea   esi,string_buffer    ; near address of string buffer
  702.         mov   ecx,len_buffer       ; byte length of buffer for the string
  703.         mov   dh,row
  704.         mov   dl,column
  705.         mov   ah,attr              ; color attribute
  706.         mov   al,2                 ; force lower case
  707.         call  tedit
  708.  
  709.  
  710.  
  711. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  712.  
  713. TMOUSELIMIT: limits mouse's range of motion on text mode screen
  714. Source:      tmlimit.asm
  715.  
  716. Call with:   DS:[BX] pointing to character coordinates of minimum and maximum
  717.              rows and columns.  Columns are the horizontal dimension and
  718.              rows are the vertical dimension.
  719. Returns:     nothing
  720. Uses:        nothing
  721. Example:
  722.  
  723. .data
  724.  
  725. x0    dw 3          ; first row
  726. y0    dw 1          ; first column
  727. x1    dw 20         ; last row
  728. y1    dw 50         ; last column
  729.  
  730. .code
  731. ; program fragment assumes DS:@DATA
  732.        .
  733.        .
  734.        .
  735.       lea    bx,x          ; DS:[BX] points to limits
  736.       call   tmouselimit
  737.  
  738. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  739.  
  740. TMOUSEPOS:   set mouse position on text-mode screen
  741. Source:      tmouspos.asm
  742.  
  743. Call with:   DH = row (vertical position)
  744.              DL = column (horizontal position)
  745. Returns:     nothing
  746. Uses:        flags
  747. Example:
  748.  
  749. ; I want to center the mouse cursor on a standard 80-column, 25-row screen
  750.  
  751. include asm.inc
  752.  
  753. extrn   tmousepos:proc
  754.  
  755. .code
  756.         .
  757.         .
  758.         .
  759.         mov    dh,12           ; close to vertical center
  760.                                ; coordinates are 0 through 24 vertially
  761.         mov    dl,39           ; coordinates are 0 through 79 horizontally
  762.         call   tmousepos
  763.  
  764.  
  765. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  766.  
  767. TMOUSESTATUS:determine mouse position on text screen & buttons pressed
  768. Source:      tmstatus.asm
  769.  
  770. Call with:   no parameters
  771.              assumes mouse is installed (see IsMouse in SYSTEM.DOC)
  772. Returns:     DH = row (vertical position)
  773.              DL = column (horizontal position)
  774.              if ZF = 1, no buttons are pressed
  775.              if ZF = 0, BX = button code
  776.               BX bit 0 if set = left button is down
  777.               BX bit 1 if set = right button is down
  778.               BX bit 2 if set = center button is down
  779. Uses:        EBX, DX, flags
  780. Example:     call  tmousestatus
  781.              jz    no_buttons     ; no buttons pressed if ZF = 1
  782.  
  783.  
  784.  
  785. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  786.  
  787. TOLOWER:     converts keycode returned by getkey to lower case
  788. Source:      tolower.asm
  789.  
  790. Call with:   AX = keycode
  791. Returns:     AX = lower case keycode
  792.              ToLower leaves the keycode alone if the keycode is not
  793.              upper case A-Z.
  794. Uses:        AX
  795. Example:     call   getkey
  796.              call   tolower
  797.  
  798.  
  799. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  800.  
  801. TOUPPER:     converts keycode returned by getkey to upper case
  802. Source:      toupper.asm
  803.  
  804. Call with:   AX = keycode
  805. Returns:     AX = upper case keycode
  806.              ToUpper leaves the keycode alone if the keycode is not
  807.              lower case a-z.
  808. Uses:        AX
  809. Example:     call   getkey
  810.              call   toupper
  811.  
  812.  
  813. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  814.  
  815. YESNO:       waits for 'Y' or 'N' key to be pressed
  816. Source:      yesno.asm
  817.  
  818. Call with:   no parameters
  819.              Key pressed may be upper or lower case.  Upper case is
  820.              returned.  Uses BIOS functions
  821. Returns:     AX = 'Y' or AX = 'N'
  822.              future version will also return ^C
  823. Uses:        AX
  824. Example:
  825.  
  826. extrn   yesno:near
  827.  
  828. include codeseg.inc
  829.  
  830.         .
  831.         .
  832.         .
  833.         call  yesno
  834.  
  835.  
  836.